***** main document *****

*delete the independents
drop if Left_right ==.

*delete uninformative speeches
drop if positivesum == 0 & negativesum == 0

*generate north and south dummy variables
gen North = 1 if Country == "Aus" |  Country == "Bel" | Country == "Den" | Country == "Fin" | Country == "Ger" | Country == "Irl" | Country == "Ned" | Country == "Swe" | Country == "UK" | Country == "Lux" 
replace North = 0 if ( North >= .)
gen East = 1 if Country == "Cro" |  Country == "Bul" | Country == "Cze" | Country == "Est" | Country == "Hun" | Country == "Lat" | Country == "Lit" | Country == "Pol" | Country == "Rom" | Country == "Slk" | Country == "Slo"
replace East = 0 if ( East >= .)

*assign labels to politicisation
label define politiciationl 0 "Non-politicized" 1 "Politicized"
label values Politicization politiciationl

*rescale eu position 
gen EU_support_10 = ( EU_Position - 1) / ( 7-1 ) * 10

*Table 1: descriptions of the variables
sum FTA_support Left_right EU_Position Politicization Delegation North East Group_speaker INTA_Member Delegation

*Table 2: OLS regression models with robust standard error
reg FTA_support Left_right EU_support_10 Group_speaker North East INTA_Member Delegation, rob
reg FTA_support i.Politicization##c.Left_right i.Politicization##c.EU_support_10 North East Group_speaker INTA_Member Delegation, rob

*Figure 1: Adjusted prediction of the effect of left-right position (left) and support for the EU (right) in politicized and non-politicized FTAs (95% CI)
margins Politicization, at (Left_right = (0 (1) 10)) vsquish atmeans
marginsplot, title ("Left-right position") xtitle ("") ytitle("") saving(a, replace) graphregion(fcolor(white)) yline (0) plot1opts (lpattern(dash)) plot2opts(lpattern(shortdash))
margins Politicization, at (EU_support_10 = (0 (1) 10)) vsquish atmeans
marginsplot, title ("EU Support") xtitle ("") ytitle("") saving(b, replace) graphregion(fcolor(white)) yline (0) plot1opts (lpattern(dash)) plot2opts(lpattern(shortdash))
gr combine a.gph b.gph, ycommon

*Figure 2: Average marginal effect of a one-unit increase of left-right position (left) and support for the EU (right) in politicised and non-politicised FTAs (95% CI)
margins, dydx(Left_right) at(Politicization=(0 (1) 1)) atmeans vsquish 
marginsplot, title ("Left-right position") ytitle("") horiz  saving(c, replace) graphregion(fcolor(white))
margins, dydx(EU_support_10) at(Politicization=(0 (1) 1)) atmeans vsquish
marginsplot, title ("EU support") ytitle("") horiz saving(d, replace) graphregion(fcolor(white))
gr combine c.gph d.gph, ycommon xcommon

***** footnote *****
*correlation between left-right and gal-tan
pwcorr Left_right Gal_Tan, sig

***** appendix *****
*Figure A2: frequency distribution of the variable Support FTAs
label var FTA_support "Support FTAs"
hist FTA_support, graphregion(fcolor(white))

*Figure A3: frequency distribution of the variable Left-right position
label var Left_right "Left-right position"
hist Left_right, graphregion(fcolor(white))

*Figure A4: frequency distribution of the variable EU support
label var EU_support_10 "EU support"
hist EU_support_10, graphregion(fcolor(white)) xlabel(0(1)10)

*Table A4: Regression models with clustered standard error for MEP
reg FTA_support Left_right EU_support_10 North East Group_speaker INTA_Member Delegation, cluster (Speaker)
reg FTA_support i.Politicization##c.Left_right i.Politicization##c.EU_support_10 North East Group_speaker INTA_Member Delegation, cluster (Speaker)

*Table A5: Regression models with clustered standard error for national party
reg FTA_support Left_right EU_support_10 North East Group_speaker INTA_Member Delegation, cluster (Party)
reg FTA_support i.Politicization##c.Left_right i.Politicization##c.EU_support_10 North East Group_speaker INTA_Member Delegation, cluster (Party)

*Table A6: regression models with country fixed effects and the omission of nationality control variables 
encode Country, gen(country_cat)
reg FTA_support Left_right EU_support_10 Group_speaker INTA_Member Delegation i.country_cat, f
reg FTA_support i.Politicization##c.Left_right i.Politicization##c.EU_support_10 Group_speaker INTA_Member Delegation i.country_cat, f

*Table A7: : Regression models with EP groups fixed effects
encode Group, gen(group_cat)
reg FTA_support Left_right EU_support_10 Group_speaker North East INTA_Member Delegation i.group_cat, f
reg FTA_support i.Politicization##c.Left_right i.Politicization##c.EU_support_10 North East Group_speaker INTA_Member Delegation i.group_cat, f


*Table A8: disaggregated regression models by agreement
gen support_TTIP = FTA_support 
replace support_TTIP = . if Agreement != "TTIP"

gen support_CETA = FTA_support
replace support_CETA = . if Agreement != "CETA"

gen support_Japan = FTA_support 
replace support_Japan = . if Agreement != "Japan"

gen support_Ausnz = FTA_support 
replace support_Ausnz = . if Agreement != "AUS_NZ"

gen support_Mercosur = FTA_support 
replace support_Mercosur = . if Agreement != "Mercosur"

gen support_Korea = FTA_support 
replace support_Korea = . if Agreement != "Korea"

reg support_TTIP Left_right EU_support_10 Group_speaker North East INTA_Member Delegation, rob
reg support_CETA Left_right EU_support_10 Group_speaker North East INTA_Member Delegation, rob
reg support_Japan Left_right EU_support_10 Group_speaker North East INTA_Member Delegation, rob
reg support_Mercosur Left_right EU_support_10 Group_speaker North East INTA_Member Delegation, rob
reg support_Ausnz Left_right EU_support_10 Group_speaker North East INTA_Member Delegation, rob
reg support_Korea Left_right EU_support_10 Group_speaker North East INTA_Member Delegation, rob
